package com.easylinkin.sm.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import java.io.Serializable;
import javax.persistence.AttributeOverride;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.Size;
import lombok.Data;
import lombok.experimental.FieldNameConstants;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import site.morn.boot.data.entity.ReviserEntity;
import site.morn.tree.TreeNode;


/**
 * 数据字典类型
 *
 * @author wujie
 * @since 0.1.1,  2019/08/22
 */

@Data
@Entity
@Table(name = "sm_dict")
@TableName("sm_dict")
@FieldNameConstants
@DynamicInsert
@DynamicUpdate
@AttributeOverride(name = "modifier", column = @Column(name = "modifier_", length = 32))
@AttributeOverride(name = "modifyTime", column = @Column(name = "modify_time_"))
@AttributeOverride(name = "creator", column = @Column(name = "creator_", length = 32))
@AttributeOverride(name = "createTime", column = @Column(name = "create_time_"))
public class Dict extends ReviserEntity implements Serializable, TreeNode {

  /**
   * 序列化
   */
  private static final long serialVersionUID = 1L;

  /**
   * 字典表ID
   */
  @Min(Long.MIN_VALUE)
  @Max(Long.MAX_VALUE)
  @Id
  @Column(name = "id_")
  @GeneratedValue
  private Long id;

  /**
   * 字典名称
   */
  @Size(max = 32)
  @Column(name = "name_", length = 32)
  private String name;

  /**
   * 字典编码
   */
  @Size(max = 32)
  @Column(name = "code_", length = 32)
  private String code;

  @Min(Integer.MIN_VALUE)
  @Max(Integer.MAX_VALUE)
  @Column(name = "level_")
  private Integer level;

  /**
   * 字典父类id
   */
  @Min(Long.MIN_VALUE)
  @Max(Long.MAX_VALUE)
  @Column(name = "parent_id_")
  private Long parentId;

  @Transient
  private String parentName;

  /**
   * 扩展属性
   */
  @Size(max = 128)
  @Column(name = "ext_")
  private String ext;

  /**
   * 排序
   */
  @Min(Integer.MIN_VALUE)
  @Max(Integer.MAX_VALUE)
  @Column(name = "order_no_")
  private Integer orderNo;

  /**
   * 显示状态
   */
  @Column(name = "display_")
  private Boolean display;

  /**
   * 备注
   */
  @Size(max = 128)
  @Column(name = "remark_", length = 128)
  private String remark;

}
